var express = require('express');
var router = express.Router();

function judge_admin_login(req){
    if (!req.session.admin){
        return false
    }
    return true
}

router.get('/index', function(req, res, next) {
   if (!judge_admin_login(req)){
       return res.redirect('/admin/login');
   }
  res.render('adconfig/index', { title: '广告配置首页' });
});

router.get('/add', function(req, res, next) {
    if (!judge_admin_login(req)){
       return res.redirect('/admin/login');
    }
    res.render('adconfig/add', { title: '广告配置首页' });
});

module.exports = router;